package ru.spb.osll.myfit.server.fixtureiterator;

import java.io.File;

public class FileDummy extends File {
	private static final long serialVersionUID = 1L;
	private String m_name;
	private File[] m_files;

	public FileDummy(String name) {
		super(name);
		m_name = name;
		m_files = null;
	}

	@Override
	public String getName() {
		return m_name;
	}

	@Override
	public boolean isFile() {
		return m_name.endsWith(".class") || m_name.endsWith(".jar")
				|| m_name.endsWith(".zip");
	}

	@Override
	public boolean isDirectory() {
		return !isFile();
	}

	@Override
	public File[] listFiles() {
		return m_files;
	}

	public FileDummy add(String... names) {
		m_files = new File[names.length];
		for(int i = 0; i < names.length; i++) {
			m_files[i] = new FileDummy(names[i]);
		}
		return (FileDummy)m_files[0];
	}
}
